package edu.whcp.comp2301.controller;

import edu.whcp.comp2301.dao.SourceDao;
import edu.whcp.comp2301.pojo.Source;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/list")
public class SourceController {
    @Autowired
    private SourceDao sourceDao;

    @RequestMapping("source")
    public ModelAndView list(){
        List<Source> sourceList=sourceDao.getSourceList();
        return new ModelAndView("sources","sourceList",sourceList);
    }
}
